<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>for循环</title>
</head>
<body>
    <button onclick="funDo()">跑二十圈</button>
    <button onclick="funSum()">100的和</button>
    <button onclick="funEven()">100中偶数的和</button>
    <button onclick="funContinue()">跳过周三</button>
    <button onclick="funBreak()">周三结束</button>
    <button onclick="funA()">1x9</button>
    <button onclick="funB()">乘法表</button>
</body>
    <script>
        function funDo(){
            for(i = 1;i<=20;i++){
                console.log("跑了第" + i + "圈")
            }
        }
        function funSum(){
            sum = 0
            for (i = 1;i<=100;i++){
                sum += i
            }
            console.log(sum)
        }
        function funEven(){
            sum = 0
            for (i = 1;i<=100;i++){
                if (i%2 == 0){
                    sum += i
                }
            }
            console.log(sum)
        }
        function funContinue(){
            for (i = 1;i<=7;i++){
                if (i == 3){
                    continue
                }
                console.log("今天周" + i)
            }
        }
        function funBreak(){
            for (i = 1;i<=7;i++){
                if (i == 3){
                    break
                }
                console.log("今天周" + i)
            }
        }
        function funA(){
            for (i = 1;i<=9;i++){
                console.log(1 + "x" + i + "=" + 1*i)
            }
        }
        function funB() {
            for (i = 1;i<=9;i++){
                for (j = 1;j<=i;j++){
                    document.write(i + "x" + j + "=" + i*j + "\t")
                }
                document.write("<br>")
            }
        }
    </script>
</html>